export function formatSeconds(value) {
  let result = parseInt(value)
  let h = Math.floor(result / 3600);
  let m = Math.floor((result / 60 % 60)) < 10 ? '0' + Math.floor((result / 60 % 60)) : Math.floor((result / 60 % 60));

  let res = '';
  if(h !== '00') res += `${h}小时`;
  res += `${m}分钟`;
  return res;
}

export const formatUrlQueryToMap = () => {
  let query = window.location.search;
  if (query.length && query[0] === "?") {
    query = query.substring(1);
  }
  const queryMap = {};
  if (query.indexOf("&") > -1) {
    query.split("&").forEach((q) => {
      const vk = q.split("=");
      queryMap[vk[0]] = vk[1];
    });
  } else {
    const vk = query.split("=");
    queryMap[vk[0]] = vk[1];
  }
  return queryMap;
};